<div id="city-bar4" style=" height: 100%">

</div>
<script type="text/javascript">
    $(function () {
        var params1=6;
        var params2=30;
        var params3=60;
        var params4=12;
        loadbar4(params1,params2,params3,params4);
    })
    function loadbar4(params1,params2,params3,params4){
        $.ajax({
            url: "#springUrl('/city/effect')",
            data: {"batchId": 59,"type":2},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('city-bar4'), 'macarons');
                    option = {
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'shadow'
                            }
                        },
                        legend: {

                        },
                        grid: {
                            left: '3%',
                            right: '8%',
                            bottom: '5%',
                            top:'5%',
                            containLabel: true
                        },
                        xAxis: {
                            type: 'value',
                            axisLine: {
                                show: false
                            },
                            axisTick: {
                                show: false
                            },
                            axisLabel: {
                                max: '100%',
                                formatter: function(value){
                                    var var1=value*1;
                                    return var1;
                                },
                                textStyle:{
                                    color:"#595959"
                                }
                            },
                            splitLine:{
                                show:true
                            },
                            splitArea: {
                                show: true,
                                areaStyle: {
                                    color: ['rgba(0,0,0,0)', 'rgba(0,0,0,0)']
                                }
                            },
                        },
                        yAxis: {
                            type: 'category',
                            data: d.data.s1,
                            axisLabel:{
                                show:true,
                                textStyle:{
                                    color:"#595959"
                                }
                            },
                            axisLine: {
                                show: false
                            },
                            axisTick: {
                                show: false
                            },
                        },
                        series: [
                            {
                                type: 'bar',
                                name:'洗涤量',
                                data: d.data.s2,
                                itemStyle: {
                                    normal: {
                                        //好，这里就是重头戏了，定义一个list，然后根据所以取得不同的值，这样就实现了，
                                        color:'#0fa99d',
                                        label: {
                                            show: true,
                                            position: 'insideRight',//数据在中间显示
                                            formatter:'{c}分钟'//百分比显示
                                        }
                                        //以下为是否显示，显示位置和显示格式的设置了
                                    }}
                            },

                        ]
                    };
                    myChart.setOption(option);
                }
            },
            error:function (text) {
                var div1="<div type='text' style='padding-top:15%' class=' text-center  '>查询数据异常</div>";
                $("#city-bar4").empty();
                $("#city-bar4").prepend(div1);
            }
        })
    }
</script>
